extends "../cTDM_4/cTDM_4.gd"
func _info():
	pass

func _connect():
	._connect()

func _extInit():
	._extInit()
	chaName = "占星师"
	lv = 3
	attCoe.atk = 27 / 8.5 * 2 / 3
	attCoe.maxHp = 750 / 112.5 / 3
	addSkillTxt("快速充能：被击中时回复5点能量，普攻能量获取提高2点")
	addSkillTxt("链式冲击：普攻可对所有生命低于25%的敌人造成伤害，并额外造成(30 + 33%物攻）点真伤")
	collect += 1

func _onHurt(atkinfo):
	._onHurt(atkinfo)
	if energy >= 100:return
	energy += 5
	if energy >= 100:
		attAdd.atk += 20 * (self.lv - 1)

func _onAtkChara(atkinfo):
	if atkinfo.hitCha != self && !atkinfo.isMiss && atkinfo.atkType == Chara.AtkType.NORMAL:
		var chas = getAllChas(1)
		chas.sort_custom(self,"sort")
		for i in chas:
			if i == atkinfo.hitCha:continue
			if i.att.hp / i.att.maxHp > 0.25:break
			hurtChara(i,att.atk,Chara.HurtType.PHY,Chara.AtkType.EFF)
			hurtChara(i,30+att.atk*0.33,Chara.HurtType.REAL,Chara.AtkType.EFF)
	._onAtkChara(atkinfo) 

func sort(a,b):
	return (a.att.hp / a.att.maxHp ) < (b.att.hp / b.att.maxHp ) 